package cn.bisoft.java.util.test;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.PrintWriter;

import javassist.bytecode.ClassFile;
import javassist.bytecode.ClassFileWriter;

public class ClassDumpUtil
{
	public static void dump(String classFilePath) throws Exception
	{
		DataInputStream in = new DataInputStream(new FileInputStream(classFilePath));
		ClassFile w = new ClassFile(in);
		PrintWriter out = new PrintWriter(System.out, true);
		out.println("*** constant pool ***");
		w.getConstPool().print(out);
		out.println();
		out.println("*** members ***");
		ClassFileWriter.print(w, out);
	}
	
	public static void main(String[] args) throws Exception {

		ClassDumpUtil.dump("E:/bisoft/code/workspace/bisoft/build/classes/cn/bisoft/java/core/F.class");
	}
}
